package com.zeny.express.framework.scheduler.quartz;

import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;

public abstract class BaseThreadJob extends BaseJob {

	protected void executeJob(JobExecutionContext context) throws Exception {

		JobDataMap data = context.getJobDetail().getJobDataMap();
		Object threadCount = data.get(DATA_THREAD_COUNT);
		Object threadNo = data.get(DATA_THREAD_NO);
		if (threadCount == null) {
			threadCount = 1;
			threadNo = 0;
		}

		executeJob(context, Integer.valueOf(threadCount.toString()),
				Integer.valueOf(threadNo.toString()));
	}

	protected abstract void executeJob(JobExecutionContext context,
			int threadCount, int threadNo) throws Exception;

}
